package com.hk.core.elasticsearch.repository;

import org.springframework.data.domain.Persistable;
import org.springframework.data.elasticsearch.core.ReactiveElasticsearchOperations;
import org.springframework.data.elasticsearch.repository.support.ElasticsearchRepositoryFactoryBean;
import org.springframework.data.elasticsearch.repository.support.ReactiveElasticsearchRepositoryFactoryBean;
import org.springframework.data.repository.core.support.RepositoryFactorySupport;

import java.io.Serializable;


/**
 * ElasticsearchRepository Factory Bean
 *
 * @param <T>
 * @param <S>
 * @author Kevin
 * @see ElasticsearchRepositoryFactoryBean
 */
public class BaseReactiveElasticsearchRepositoryFactoryBean<T extends BaseReactiveElasticsearchRepository<S, ID>,
        S extends Persistable<ID>, ID extends Serializable>
        extends ReactiveElasticsearchRepositoryFactoryBean<T, S, ID> {

    /**
     * Creates a new {@link ReactiveElasticsearchRepositoryFactoryBean} for the given repository interface.
     *
     * @param repositoryInterface must not be {@literal null}.
     */
    public BaseReactiveElasticsearchRepositoryFactoryBean(Class<? extends T> repositoryInterface) {
        super(repositoryInterface);
    }

    @Override
    protected RepositoryFactorySupport getFactoryInstance(ReactiveElasticsearchOperations operations) {
        return new BaseReactiveElasticsearchRepositoryFactory(operations);
    }

}
